home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_01_05 / 1n05009a < prev    next >
Text File  |  1990-08-20  |  876b  |  41 lines

  1. #include <dos.h>
  2.  
  3. /* 8514/A display adapter support - call AI */
  4.  
  5. int c8514(nentry,pqbl)
  6. int nentry; /* number of entry to call */
  7. char *pqbl; /* parameter block */
  8. /* returns nonzero if call cannot be made */
  9.  
  10. {
  11.   static int linit = 0;
  12.   static void pascal (**pptab)(char *);
  13.  
  14.   if (!linit) { /* initialize first time */
  15.  
  16.     /* be sure the AI is installed */
  17.     _AX = 0x3500+0x7F;
  18.     geninterrupt(0x21);
  19.     if (_BX == 0 && _ES == 0) return (1);
  20.  
  21.     /* get the address of the entry table */
  22.     _AX = 0x0105;
  23.     geninterrupt(0x7F);
  24.     asm jnc initok
  25.     return (1);
  26. initok:
  27.     ((int *)&pptab)[0] = _DX;
  28.     ((int *)&pptab)[1] = _CX;
  29.     linit = 1; /* initialization done */
  30.   }
  31.   if (nentry < 0) return (0);
  32.  
  33.   /* call the entry */
  34.   asm push si
  35.   asm push di
  36.   (*pptab[nentry])(pqbl);
  37.   asm pop di
  38.   asm pop si
  39.   return (0);
  40. }
  41.